package org.example.SSM;

import org.example.SSM.Service.userService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class uController {

    @Autowired
    private userService service;
    @RequestMapping("/user")
    public ModelAndView findUserId(Integer id){
        User user = service.findUserId(id);
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.setViewName("/SSM/user.jsp");         //设置视图路径
        modelAndView.addObject("user",user);
        return modelAndView;
    }
}
